package com.candy.th7;


/**
 * @author donglin
 * @Title:
 * @类名: Child
 * @date 2020/7/22
 */
public class Mother extends Thread{

    private Kitchen kitchen;

    public Mother(Kitchen kitchen) {
        super("妈妈");
        //设置为守护线程，孩子们吃饱后，妈妈停止做饭
        this.setDaemon(true);
        this.kitchen = kitchen;
    }

    public void cock(){
        try {
            //做饭操作
            this.kitchen.do_cock();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void run() {
        while (true) {
            this.cock();

        }
    }
}
